<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
if(null!=request.getSession().getAttribute("login")){
	String login = request.getSession().getAttribute("login").toString();
	if("true".equals(login)){
		//ok
	}else{
		response.sendRedirect("index.jsp");
	}
}else{
	response.sendRedirect("index.jsp");
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set     -->
<!-- the browser's rendering engine into           -->
<!-- "Quirks Mode". Replacing this declaration     -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout.   -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>fwswaper</title>
    <script src="/js/base64coder.js" type="text/javascript"></script>
    <script type="text/javascript">
	<!--//
		function valid_url(str_url) {
		
			var regex = new RegExp("^((https|http)?://)"
				+ "(([0-9]{1,3}.){3}[0-9]{1,3}"			// IP
				+ "|"									// IP or domain
				+ "([0-9a-z_!~*'()-]+.)*"				// domain
				+ "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]."	// sub domain
				+ "[a-z]{2,6})"							// first level domain
				+ "(:[0-9]{1,4})?"						// port
				+ "((/?)|"								// a slash isn't required if there is no file name
				+ "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$");

			return regex.test(str_url);
		}

	    function openurl(){
	    
	    	var url = document.url_form.url.value;
	    	
	    	if (valid_url(url)){
	    		//document.domain
	    		//window.open(location.href + "swap/" + base64encode(url));
	    		window.open("swap/" + base64encode(url));
	    	}
		}
	//-->
	</script>
  </head>

  <body>
    <h1>Mr.Deng Xiaoping said:Science and technology constitute a primary productive force.
    </h1>
    <form method="get" action="javascript:openurl();" name="url_form">
    	<p><input type="text" name="url" value="http://" size=100>
    	<input type="submit" value="GO!" onclick="openurl(); return false;"></p>
    </form>
	<br>
	Credits:
	<br>
	<a href="javascript:;" onclick="javascript: window.open('swap/' + base64encode('http://lzy.javaeye.com'));">
	http://lzy.javaeye.com</a><br>
	<a href="javascript:;" onclick="javascript: window.open('swap/' + base64encode('http://moussa.javaeye.com'));">
	http://moussa.javaeye.com</a>
  </body>
</html>
